package com.miniapp.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.miniapp.entity.MiniTemplateInfoEntity;
import com.miniapp.mapper.MiniTemplateInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import  com.miniapp.utils.BaseUtils;

import org.springframework.beans.BeanUtils;

import com.miniapp.mapper.MiniTemplateMapper;
import com.miniapp.entity.MiniTemplateEntity;
import com.miniapp.service.MiniTemplateService;

import java.util.List;


@Service("miniTemplateService")
public class MiniTemplateServiceImpl extends BaseServiceImpl<MiniTemplateMapper,MiniTemplateEntity>  implements MiniTemplateService {


    @Override
    public List<MiniTemplateEntity> findByProductId(Long id) {
        return baseMapper.selectList(new QueryWrapper<MiniTemplateEntity>().eq("product_id",id).orderByDesc("is_default"));
    }

    @Override
    public MiniTemplateEntity findByProductIdAndDefault(Long productId, int i) {
        return baseMapper.selectOne(new QueryWrapper<MiniTemplateEntity>().eq("product_id",productId).eq("is_default",i));
    }
}
